﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace MM.Common.UI.Controls
{
    public class UCComboBoxInputItems : CollectionBase
    {
        // Methods
        public void Add(UCComboBoxInputItem aItem)
        {
            bool flag = false;
            for (int i = 0; i < base.List.Count; i++)
            {
                if (((UCComboBoxInputItem)base.List[i]).ItemName == aItem.ItemName)
                {
                    ((UCComboBoxInputItem)base.List[i]).FieldName = aItem.FieldName;
                    ((UCComboBoxInputItem)base.List[i]).ItemWidth = aItem.ItemWidth;
                    ((UCComboBoxInputItem)base.List[i]).ItemType = aItem.ItemType;
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                base.List.Add(aItem);
            }
        }

        private void Initialize()
        {
        }

        public void Insert(int index, UCComboBoxInputItem aItem)
        {
            base.List.Insert(index, aItem);
        }

        public void Remove(int index)
        {
            if ((index < (base.Count - 1)) && (index > 0))
            {
                base.List.RemoveAt(index);
            }
        }

        // Properties
        public UCComboBoxInputItem this[int index]
        {
            get
            {
                return (UCComboBoxInputItem)base.List[index];
            }
            set
            {
                base.List[index] = value;
            }
        }
    }
}
